## This file sets the working directory and number of cores, installs packages,
## and creates a conda environment that will be used for running BRS

## Set working directory -----------------------------
rep_path <- ""  # set this to be the replication folder
setwd(rep_path)

## Install BRS function from source and load python ---------------------------
# make sure you have all dependencies installed first
install.packages(c("reticulate", "circlize", "Rtsne"))

# install BRS
install.packages("BRS_0.0.0.9006.tar.gz", repos = NULL, type="source")
# Also check that you have python and the required packages listed in readme.txt

# Python
reticulate::conda_install(envname = "BRS_conda",
  packages = c("numpy", "pandas", "scikit-learn", "scipy"),
  python_version = "3.6.1")


## other required packages ---------------------------
install.packages("doParallel")
install.packages("dplyr")
install.packages("BRS")
install.packages("QCA")
install.packages("ggplot2")
install.packages("cowplot")
install.packages("RColorBrewer")
install.packages("prettyGraphs")
install.packages("kableExtra")
install.packages("rpart")
install.packages("rpart.plot")
install.packages("randomForest")
install.packages("glmnet")
install.packages("gtools")
install.packages("gridExtra")

# install "ggpattern" from github
install.packages("remotes")
remotes::install_github("coolbutuseless/ggpattern")

########### Initiate ################

## Set number of cores to use (will be passed to doParallel::registerDoParallel)
numCores <- 4

## Load helper functions -----------------------------
source("helper.R")

## Python
reticulate::use_condaenv("BRS_conda")  ## use this conda environment for BRS
